package com.mall.dubbo.api;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mall.dubbo.mapper.OmsOrderReturnReasonMapper;
import com.mall.model.domain.OmsOrderReturnReason;
import org.apache.dubbo.config.annotation.DubboService;

import java.util.List;

/**
 * @author xyiaao
 * @description 针对表【oms_order_return_reason(退货原因表)】的数据库操作Api实现
 * @createDate 2022-03-29 19:46:09
 */
@DubboService
public class OmsOrderReturnReasonApiImpl extends ServiceImpl<OmsOrderReturnReasonMapper, OmsOrderReturnReason>
        implements OmsOrderReturnReasonApi {

    @Override
    public void updateStatus(List<Long> ids, Integer status) {

        LambdaUpdateWrapper<OmsOrderReturnReason> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.set(OmsOrderReturnReason::getStatus, status);
        updateWrapper.in(OmsOrderReturnReason::getId, ids);
        this.update(updateWrapper);
    }

    @Override
    public Page<OmsOrderReturnReason> listPage(Integer pageNum, Integer pageSize) {

        Page<OmsOrderReturnReason> page = new Page<>(pageNum, pageSize);
        LambdaQueryWrapper<OmsOrderReturnReason> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.orderByDesc(OmsOrderReturnReason::getSort);
        this.page(page, queryWrapper);
        return page;
    }

}




